package com.jhg.drgclinicalpathway.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jhg.drgclinicalpathway.domain.DRGs_病人分组结果;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DRGs_病人分组结果Dao extends BaseMapper<DRGs_病人分组结果> {

    @Select({
            "<script>",
            "SELECT top 100 a.jbbm,a.jbmc,(case b.bfz  when 1 then 'MCC' when 2 then 'CC' else '' end) zt ",
            " from YB_CHS_JBBMDZ a left join YB_CHS_BFZML b on a.jbbm=b.jbbm ",
            " where a.jbbm!='' and (a.jbbm like '${val}%' or a.jbmc  like '%${val}%' ) order by a.jbbm",
            "</script>"
    })
    public List<Map<String, Object>> getDrigneList(@Param("val") String val);

    @Select({
            "<script>",
            " SELECT distinct top 100 编码 ssbm,名称 ssmc from v手术编码目录 " ,
            " where 编码!='' AND  (编码 like '${val}%' or 名称 like '%${val}%' or 简码 like '%${val}%' or 五笔码 like '%${val}%') order by 编码" ,
            "</script>"
    })
    public List<Map<String, Object>> getSSList(@Param("val") String val);

    @Select({
            "<script>",
            "select top 110 手术编码 jbbm,b.名称 zdms from  jc_疾病对应手术 as a,JC_手术编码目录 b  " ,
            " where a.手术编码=b.编码 and 版本='3.0' and a.疾病编码='${bm}'  order by jbbm" ,
            "</script>"
    })
    public List<Map<String, Object>> getXgSSList(@Param("bm") String bm);

    @Select({
            "<script>",
            "select  a.sscx,a.ssbm,a.ssmc from [dbo].[TMP_手术信息] as a where a.jzh='${jzh}' and jlly=3 order by a.sscx",
            "</script>"
    })
    public List<Map<String, Object>> getBrSSList(@Param("jzh") String jzh);
}
